import 'package:base_plugin/base_plugin.dart';
import 'package:finance_app/generated/l10n.dart';
import 'package:finance_app/src/common/app_colors.dart';
import 'package:flutter/material.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:finance_app/src/common/config.dart';

import 'src/page/animated_splash_page.dart';

final RouteObserver<PageRoute> routeObserver = RouteObserver();

class App extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      key: ValueKey('_app'),
      title: Config.appName,
      debugShowCheckedModeBanner: false,
      home: AnimatedSplashPage(),
      theme: ThemeData(
        primaryColor: aceBlueColor,
        scaffoldBackgroundColor: Colors.white,
        visualDensity: VisualDensity.adaptivePlatformDensity,
        fontFamily: "DinRoundPro",
      ),
      onGenerateRoute: RRouter.myRouter.routerGenerate,
      localizationsDelegates: [
        S.delegate,
        GlobalMaterialLocalizations.delegate,
        GlobalCupertinoLocalizations.delegate,
        GlobalWidgetsLocalizations.delegate,
      ],
      supportedLocales: [
        Locale('en'),
        Locale('zh'),
      ],
      locale: Locale(Config.languageCode),
      navigatorObservers: [
        RRouter.myRouter.observer,
        routeObserver,
      ],
    );
  }
}
